function FINUtil(t,a){
    function e(){
        return(65536*(1+Math.random())|0).toString(16).substring(1)
    }
    this.channelId=t,
        this.customerId=a,
        this.method="post",
        this.requestid=e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e(),
        this.smallAgents="NWD|HDW|PP_DAI|CRF|JFDD",
        this.protocol="http:"===window.location.protocol?"http://":"http://",
        // this.domain="api.ykfazhan.cn",
        this.domain="localhost:8081/webview",
        this.baseAction=this.protocol+this.domain+"/rest/load/api/post",
        // this.activiteUrl=this.protocol+this.domain+"/rest/native/api/transfer/call/json",
        this.activiteUrl=this.protocol+this.domain+"/user/signUp",
        this.activiteCallbackName="cbfName",
        this.smallUrl=this.protocol+this.domain+"/rest/load/api/mutil/post",
        this.smallSimUrl=this.protocol+this.domain+"/rest/load/api/mutil_sim/post",
        this.simUrl=this.protocol+this.domain+"/rest/native/api/transfer/call/simjson",
        this.agentUrl=this.protocol+this.domain+"/rest/load/api/",
        this.agreeInsUrl=this.protocol+this.domain+"/rest/native/ins/api/call/json",
        this.action=this.baseAction,this.activiteParaName="p",
        this.paraAgentKey="agentkey",
        this.activiteKey="670a0be4198343e7019bce4cffa5db78",
        this.data={},
        this.fromUrl=location.href,
        this.referer=document.referrer,
        this.dataRange={
            phoneno:{require:!0,range:[],format:/^1[34578]\d{9}$/},
            name:{require:!0,range:[],format:/^[\u4e00-\u9fa5]{2,4}$/},
            money:{require:!0,range:[],format:/^[1-9]\d*$/},
            userid:{require:!1,range:[],format:""},
            account:{require:!1,range:[],format:""},
            sex:{require:!1,range:[],format:""},
            loanType:{require:!1,range:[],format:""},
            loanTime:{require:!1,range:[],format:""},
            province:{require:!1,range:[],format:""},
            city:{require:!0,range:[],format:/^[\u4e00-\u9fa5]{2,10}$/},
            area:{require:!1,range:[],format:""},
            plantform:{require:!1,range:[],format:""},
            education:{require:!1,range:[],format:""},
            profession:{require:!1,range:[],format:/(^[0|1|2]?$)|(^[9]{2}$)/},
            socialSecurity:{require:!1,range:[],format:/^[0|1]?$/},
            housingFund:{require:!1,range:[],format:/^[0|1]?$/},
            housingType:{require:!1,range:[],format:/^[1|2|3]?$/},
            hasCar:{require:!1,range:[],format:/^[1|2|3]?$/},
            creditSituation:{require:!1,range:[],format:/^[1|2|3]?$/},
            backUrl:{require:!1,range:[],format:/^(http|https):\/\/[a-z|A-Z|0-9|.|_|\-]{1,}.[a-z|A-Z|0-9|.|_|\-]{1,}[a-z|A-Z|0-9|.|=|\/|_|\-|\?|\&|\%|\{|\}|\[|\]|:]{0,}/},
            ip:{require:!1,range:[],format:""},
            birthday:{require:!1,range:[],format:""},
            idCard:{require:!1,range:[],format:/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/},
            income:{require:!1,range:[],format:""},
            insurance:{require:!1,range:[],format:""},
            info:{require:!1,range:[],format:""},
            paytype:{require:!1,range:[],format:""},
            worklong:{require:!1,range:[],format:""},
            acceptsafety:{require:!1,range:[],format:""},
            lifeInsurance:{require:!1,range:[],format:""},
            auditBy:{require:!1,range:[],format:""}
    },
        this.fixedData={
            requestid:{require:!0,range:[],format:""},
            referer:{require:!0,range:[],format:""},
            channel:{require:!0,range:[],format:""},
            fromUrl:{require:!0,range:[],format:""},
            cid:{require:!0,range:[],format:""}
    },
        this.init()
}
function isNullValue(t){
    if(void 0===t)
        return!0;
    if(void 0===t)
        return!0;
    var a=t+"";
    return""===(a=a.replace(/(^\s*)|(\s*$)/g,""))
}
FINUtil.prototype.init=function(){},
    FINUtil.prototype.createFormAndSubmit=function(){
        this.createFormData();
        var t=$("<form id='ec_findatasubmitform' method='"+this.method+"'></form>");
        t.attr({action:this.action+"?r="+Math.random()});
        var a;
        $.each(this.data,function(e,i){
            (a=$("<input type='hidden'>")).attr({name:e}),a.val(i),t.append(a)}),
            t.appendTo("body").submit()
        },
    FINUtil.prototype.createFormData=function(){
        this.data.channel=this.channelId,
            this.data.cid=this.customerId,
            this.data.requestid=this.requestid,
            this.data.referer=this.referer,
            this.data.fromUrl=this.fromUrl
    },
    FINUtil.prototype.submit=function(t){
        void 0!==t&&(this.data=t),
        this.checkData()&&this.createFormAndSubmit()},
    FINUtil.prototype.submitSingle=function(t){
        isNullValue(t)||(this.action=this.agentUrl+t+"/post",this.submit())
    },
    FINUtil.prototype.submitAgents=function(){
        this.appendData("postAgents",this.smallAgents),
            this.action=this.smallUrl,
            this.submit()},
    FINUtil.prototype.submitSimAgents=function(t){
        this.action=this.smallSimUrl,
            this.appendData("agentkey",t),
            this.submit()},
    FINUtil.prototype.activiteCall=function(t,a,e){
        if(this.appendData("plantform",t),this.checkData()){
            this.createFormData();
            // var i=this.activiteUrl+"?"+this.activiteParaName+"="+encodeURIComponent(this.activiteCryptoData());
            var i="userInfo/complement?"+this.activiteParaName+"="+encodeURIComponent(this.activiteCryptoData());

            isNullValue(e)||(i+="&agentid="+e),
            isNullValue(a)||(i+="&"+this.activiteCallbackName+"="+a),
                // $.ajax({type:"post",url:i,dataType:"jsonp"});
                $.ajax({
                    url:i,
                    type:"POST",
                    dataType:"json",
                    success: function(data){
                        if(data.code == 200 ){
                            // var tzurl = "http://www.ecsage.cn/new/page3/index3/index.html"
                            // window.location.href = tzurl;
                            submitCallback();
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown){
                        console.log(XMLHttpRequest);
                        alert("请求失败，请重新进行提交");
                    }
                });
            }},
    FINUtil.prototype.activiteSimCall=function(t,a,e){
        if(this.appendData("plantform",t),this.checkData()){
            this.createFormData();
            var i=this.simUrl+"?"+this.activiteParaName+"="+encodeURIComponent(this.activiteCryptoData());
            isNullValue(e)||(i+="&agentkey="+e),isNullValue(a)||(i+="&"+this.activiteCallbackName+"="+a),
                $.ajax({type:"get",url:i,dataType:"jsonp"})}},
    FINUtil.prototype.activiteCryptoData=function(){
        var t=CryptoJS.enc.Latin1.parse(this.activiteKey),
            a=CryptoJS.enc.Latin1.parse(this.activiteKey),
            e=JSON.stringify(this.data);
        // return CryptoJS.AES.encrypt(e,t,{iv:a,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding}).toString()},
        return e.toString();},
    FINUtil.prototype.checkData=function(){
        var t=this.checkParameter,a=this.dataRange;
        return $.each(this.data,function(e,i){if(!t(a,e,i))return!1}),!0},
    FINUtil.prototype.checkParameter=function(dataRange,paraName,paraValue){
        var dataDefine=dataRange[paraName];
        if(void 0!==dataDefine&&""!==dataDefine){
            var reg;
            return dataDefine.require?isNullValue(dataDefine.format)?!isNullValue(paraValue):(reg=dataDefine.format).test(paraValue):!!isNullValue(dataDefine.format)||(reg=eval(dataDefine.format)).test(paraValue)}},
    FINUtil.prototype.appendData=function(t,a){
        void 0===t?delete this.data[t]:this.data[t]=a},
    FINUtil.prototype.appendDataSet=function(t){
        if("object"==typeof t&&t instanceof Array)
            for(var a=0;a<t.length;a++)
                for(var e in t[a])
                    ""===t[a][e]||void 0===t[a][e]||null===t[a][e]||(this.data[e]=t[a][e])},
    FINUtil.prototype.clearData=function(){
        this.data={}},
    FINUtil.prototype.defineDataRange=function(t){this.dataRange=t},
    FINUtil.prototype.agreeIns=function(m,i){
            if(!isNullValue(m)&&!isNullValue(i)){
                var i=this.agreeInsUrl+"?phoneno="+m+"&insurance="+i;$.ajax({type:"get",url:i,dataType:"jsonp"})}};